/*! @file searchthread.h
  * @brief Definition of SearchThread Class
  * This class subclasses QThread
  * It starts a db search in a thread
  * @author AK
  * @date 01.07.2012
  */

#ifndef SEARCHTHREAD_H
#define SEARCHTHREAD_H

#include <QThread>

#include "defines.h"
#include "sqlite3.h"

//! @brief Definition of SearchThread Class
class SearchThread : public QThread
{
    Q_OBJECT

public:
    SearchThread(sqlite3*,          // db handle
                 QString,           // sql query string
                 int,               // db size in mb
                 int);              // caller 0=tab0, 1=tab1
    void            run();
    void            stop();

    volatile bool   stopped;

Q_SIGNALS:
    void            finished(ResultSet);       // columns
    void            started();

private:
    ResultSet       res;
    char            **results;
    sqlite3         *tmp;
    int             tmpCal;        // @sa caller in constructor
    int             tmpCol;
    char            *tmpErr;
    int             tmpMb;
    int             tmpRow;
    QString         tmpSql;
};

#endif // SEARCHTHREAD_H
